<template>
  <div class="hot-goods w">
    <div class="left">
      <h4>{{ props.title }}</h4>
      <small>{{ props.subTitle }}</small>
    </div>
    <div class="right" v-if="props.more" @click="toHotCate(props.cateId)">
      查看更多
      <el-icon>
        <ArrowRight />
      </el-icon>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ArrowRight } from "@element-plus/icons-vue";
import { useRouter } from "vue-router";
const router = useRouter();
type propsType = {
  title: string;
  subTitle?: string;
  more?: boolean;
  cateId: number;
};
const props = defineProps<propsType>();

const toHotCate = (cateId: number) => {
  router.push({ path: "/category", query: { cateId: cateId } });
};
</script>

<style scoped lang="less">
.hot-goods {
  height: 54px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  .left {
    display: flex;
    align-items: flex-end;
    h4 {
      font-size: 24px;
      font-weight: 400;
    }
    small {
      margin-left: 20px;
      font-size: 14px;
      color: #666;
    }
  }
  .right {
    display: flex;
    align-items: flex-end;
    color: #666;
    text-align: center;
    cursor: pointer;
    .el-icon {
      margin-left: 3px;
      margin-bottom: 3px;
    }
  }
}
</style>
